#include <iostream>
#include <fstream>
#include <vector>
#include "../utils.h"
#include "../mat_pq.h"
#include "../gauss_banda.h"
using namespace std;

int main(int argc, char *argv[]) {
	if (argc!=2) {
		cout << "USO: testMat archivoEntrada" << endl;
		return 1;
	}
	ifstream in(argv[1]);
	int n;
	in >> n;
	vector< vector<double> > mx(n, vector<double>(n));
	forn(i,n)forn(j,n) in >> mx[i][j];// >> my[i][j];
	int p=0,q=0;
	forn(i,n)forn(j,n) if (mx[i][j]!=0.0) {
		if (j>i) q=max(q,j-i); else p=max(p,i-j);
	}
	cout << "BANDA " << p << " " << q << endl;
	mat m = newMat(n,p,q);
	forn(i,n)forn(j,n) if (mx[i][j]!=0.0) getPQ(m,p,q,i,j)=mx[i][j];
	showPQ(m,p,q);
	vector<double> r = solve(m,p,q);
	forn(i,n) cout << r[i] << " "; cout << endl;
	return 0;
}
